#ifndef MMU_H_
#define MMU_H_
#include "confFile.h"
#include "prm.h"
#include <stdlib.h>
#include <pthread.h>

typedef struct iptRec{
	int pid;
	int logicPageNum;
	int dirtyBit;
	int referenceBit;
	int next;
	int prev;
	unsigned int ageReg;
}iptRecord;
iptRecord *ipt;
int* hat;
//pthread_mutex_t  iptMutex;
void insertIptRecord(int pid, int pageNum, int recordIndexToRemove);
void initIptRecord(iptRecord* rec,int pid, int logicPage);
void initIpt();
void initHat();
int hash(int num);
int hatGetIptFirstRec(int pid, int vPageNum);
int iptGetPageIndexInMM(int pid, int logicalNum);
int getNextFreePageInMM();
void setNewAge(int iptIndex);
void printMMUTable();
void printIPTRecord(iptRecord rec);
void printRegisters();
void printHat();
void printHatRec(int index);
void killHat();
void killIpt();


#endif /*MMU_H_*/
